package com.dingreading.cloud.subject.service.impl;

import com.dingreading.cloud.subject.entity.AppProject;
import com.dingreading.cloud.subject.entity.table.AppProjectTableDef;
import com.dingreading.cloud.subject.mapper.AppProjectMapper;
import com.dingreading.cloud.subject.service.AppProjectService;
import com.mybatisflex.core.query.QueryWrapper;
import org.springframework.stereotype.Service;

/**
 * 服务层实现。
 *
 * @author Administrator
 * @since 2024-08-01
 */
@Service
public class AppProjectServiceImpl extends BaseServiceImpl<AppProjectMapper, AppProject, AppProjectTableDef> implements AppProjectService {

    @Override
    protected AppProjectTableDef getTable() {
        return AppProjectTableDef.appProject;
    }

    @Override
    public String getAppSecret(String appId) {
        QueryWrapper wrapper = QueryWrapper.create()
                .select(table.appSecret)
                .from(table)
                .where(table.appId.eq(appId));
        return getMapper().selectObjectByQueryAs(wrapper, String.class);
    }
}
